from AOPy import *
from Aspects import *

if __name__ =="__main__":
    from Aspects import Writer
    print "starting"
    w = Writer("write", "2", ["chunksize"])

    getPointcutter().addPointcuter(w)
    
    


    @weave
    def write(inf,of, chunksize=100):
        b = inf.read(chunksize)
        if b=="":
            return True
        of.write(b)
        return False
    

    def log(infile, outfile, chunksize):
        inf = open(infile,"rb")
        of = open(outfile,"wb")
        
        while True:
            done = write(inf, of, chunksize=chunksize)
            if done: break
        
        inf.close()
        of.close()
        
    log("infile","outfile",100)